/**
 * Shield.java
 */
// $codepro.audit.disable numericLiterals
package edu.gatech.startrader.ship;

/**
 * Shield Enumerated Type
 * The types of shields a ship can have.
 * The kind of shield a ship can have depends on the tech level of a system
 * @author Team Bamf (Team 30)
 */
public enum Shield {
	/**
	 * Energy shield is the less effective of the two shields
	 */
	ENERGY_SHIELD(3,1200),
	
	/**
	 * Reflective shield is the best shield
	 */
	REFLECTIVE_SHIELD(7,2500);
	
	/**
	 * How much damage the shield will decrease by
	 */
	private final int damageNullification;
	
	/**
	 * How expensive the shield is in a planet's shipyard
	 */
	private final int price;
	
	/**
	 * creates a shield object
	 * @param defensePower defensive power of the shield
	 * @param shieldPrice the price of the shield
	 */
	private Shield(int defensePower, int shieldPrice) {
		damageNullification = defensePower;
		price = shieldPrice;
	}
	
	/**
	 * gets the damage nullification
	 * @return the damage nullification
	 */
	public int getDefensivePower() {
		return damageNullification;
	}
	
	/**
	 * gets the price of the shield 
	 * @return the price of the shield
	 */
	public int getPrice() {
		return price;
	}
	
	/**
	 * Returns the Shield object as a String
	 * @return the object as a String
	 */
	public String toString() {
		final String name = super.toString();
		final StringBuilder result = new StringBuilder(name.length());
		final String[] words = name.toLowerCase().split("_");
		for(int i = 0; i < words.length; ++i) {
			if(i > 0) {
				result.append(' ');
			}
		  	result.append(Character.toUpperCase(words[i].charAt(0)));
		  	result.append(words[i].substring(1));
		}
		return result.toString();
	}
}
